#include "CollisionDispatcher.h"
#include "GameManager.h"

CCollisionDispatcher::CCollisionDispatcher(void)
{
	IPhysxManager *physx = CGameManager::getInstance()->getPhysxManager();

	// register our callback with the physx manager
	physx->setContactCallback(new SPhysxCallbackT<CCollisionDispatcher>(&CCollisionDispatcher::collisionCallback, this));
}
CCollisionDispatcher::~CCollisionDispatcher(void)
{
}
bool CCollisionDispatcher::collisionCallback(IPhysxObject* obj_one, IPhysxObject* obj_two){
	CSceneObject *ptr_one, *ptr_two;

	ptr_one = (CSceneObject *)obj_one->getUserData();
	ptr_two = (CSceneObject *)obj_two->getUserData();

	// call the colliders callbacks
	ptr_one->collisionCallback(ptr_two);
	ptr_two->collisionCallback(ptr_one);

	return false;
}


